package cn.servlet;

import cn.dao.StaffDao;
import cn.dao.StaffDaoImpl;
import cn.entity.Staff;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/staff_list")
public class ListServlet extends HttpServlet {
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        StaffDao dao = new StaffDaoImpl();
        List<Staff> staffList = dao.findALL();
        req.setAttribute("staff", staffList);
        req.getRequestDispatcher("staff_list.jsp").forward(req, resp);
    }
}
